package com.hbnu.service;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class ReceiveThread implements Runnable{
    private Socket socket;
    public ReceiveThread(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        while (true){
                String message =in.readLine();
                if (message.equals("esc")||message.equals("账号注销成功!")) {
                    System.exit(0);
                    break;
                }
                System.out.println(message);
        }
        } catch (IOException e) {
            e.printStackTrace();
            Thread thread =Thread.currentThread();
            thread.stop();
        }
    }
}
